
<%@page import="com.wanmait.shoppingsys.vo.City"%>
<%@page import="com.wanmait.shoppingsys.vo.Specialty"%>
<%@page import="com.wanmait.shoppingsys.vo.Type"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.wanmait.shoppingsys.util.ManagePager"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<jsp:include page="/TypeShowAllController"></jsp:include>
<jsp:include page="/CityShowAllController" ></jsp:include> 
<%
String path = request.getServletContext().getContextPath();
%> 
<head>
<meta charset="UTF-8">
<title>编辑商品</title>
<link rel="stylesheet" href="<%=path %>/css/font.css">
<link rel="stylesheet" href="<%=path %>/css/xadmin.css">
<script type="text/javascript" src="<%=path %>/js/jquery-3.3.1.min.js"></script> 
<script type="text/javascript" src="<%=path %>/lib/layui/layui.js"	charset="utf-8"></script>
<script type="text/javascript" src="<%=path %>/js/xadmin.js"></script>

</head>
<body class="form-wrap">
	<%
		Specialty specialty = (Specialty) request.getAttribute("specialty");
	%>
	<div class="layui-fluid">
		<div class="layui-card">
			<div class="layui-card-header">商品编辑</div>
			<div class="layui-card-body" style="padding: 15px;">
				<form class="layui-form" lay-filter="component-form-group"
					action="/ShoppingSys/SpecialtyManageController?action=save&specialtyId=<%=specialty.getId() %>"
					method="post">
					<div class="layui-form-item">
						<label class="layui-form-label">物品</label>
						<div class="layui-input-block">
							<input type="text" name="name"
							value="<%=specialty.getName()%>" lay-verify="title" autocomplete="off"  class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">类型</label> 
						<div class="layui-input-block">
						<select  name="typeId">
							<%
								List<Type> types = (List<Type>) request.getAttribute("types");
								for (int i = 0; i < types.size(); i++) {
									Type type = types.get(i);
									if (type.getId().equals(specialty.getType().getId())) {
							%>
							<option value="<%=type.getId()%>" selected><%=type.getKind()%></option>
							<%
								} else {
							%>
							<option value="<%=type.getId()%>"><%=type.getKind()%></option>
							<%
								}
								}
							%>
						</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">城市</label> 
						<div class="layui-input-block">
							<select name="cityId">
							<%
							List<City> citys=(List<City>)request.getAttribute("citys"); 
							for(int i=0;i<citys.size();i++){
							City city=citys.get(i);
							if (city.getId().equals(specialty.getCity().getId())) {
							%>
							<option value="<%=city.getId()%>" selected><%=city.getName() %></option>
							
							<%
								} else {
							%>
							<option value="<%=city.getId()%>"><%=city.getName()%></option>
							<%
							}}
							%>
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">价格</label>
						<div class="layui-input-block">
							<input type="text" name="price"
								value="<%=specialty.getPrice()%>" lay-verify="
								title" autocomplete="off" 
								class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">图片</label>
						<div class="layui-input-block">
							<input type="file" name="pic"
								value="<%=specialty.getPic()%>" lay-verify="
								title" autocomplete="off" 
								class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">介绍</label>
						<div class="layui-input-block">
							<textarea style="height:100px;" rows="10" cols="60" name="introduce" lay-verify="title"
								autocomplete="off"  class="layui-input"><%=specialty.getIntroduce()%></textarea>
						</div>
					</div>
					<div class="layui-form-item layui-layout-admin">
						<div class="layui-input-block">
							<div class="layui-footer" style="left: 0;">
								<button class="layui-btn" lay-submit=""
									lay-filter="component-form-demo1">立即提交</button>
								<button type="reset" class="layui-btn layui-btn-primary">重置</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
</html>